package org.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author weigang
 * @create 2022-11-14 16:08
 */
@RestController
@Slf4j
public class HttpFeignProviderController {

    @Value("${server.port}")
    private String serverPort;
    @Value("${spring.application.name}")
    private String springApplicationName;

    @GetMapping("/user/getUserNameById")
    public String getUserNameById(@RequestParam("userId") String userId){
        log.info("userId:{}",userId);
        return "张学友";
    }

    @GetMapping("/product/getProductNameById")
    public String getProductNameById(@RequestParam("productId") String productId){
        return "iphone 13";
    }

    @GetMapping("/loadBalanceDemo/getProviderInfo")
    public String getProviderInfo(){
        return "当前Provider-springApplicationName: " + springApplicationName + ",端口为：" + serverPort;
    }
}
